//
//  SelectedDeviceTableViewCell.m
//  MicrowaveLight
//
//  Created by Kendama on 2017/6/23.
//  Copyright © 2017年 DT. All rights reserved.
//

#import "SelectedDeviceTableViewCell.h"

@interface SelectedDeviceTableViewCell ()


@property(nonatomic,strong) UILabel *titleLabel;
@property(nonatomic,strong) UIImageView *lightView;
@property(nonatomic,strong) UIImageView *onlineView;

@end

@implementation SelectedDeviceTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self masLayoutSubviews];
    }
    return self;
}

- (void)masLayoutSubviews{
    __weak UIView *superView = self.contentView;
    [self.lightView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(superView.mas_top);
        
    }];
}

+ (instancetype)cellWithTableView:(UITableView *)tableView
{
    static NSString *ID = @"SelectedDeviceTableViewCell";
    id cell = [tableView dequeueReusableCellWithIdentifier:ID];
    
    if (cell == nil) {
        cell = [[self alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:ID];
    }
    return cell;
}

- (UILabel *)titleLabel
{
    if(!_titleLabel)
    {
        UIView *superView = self.contentView;
        _titleLabel = [[UILabel alloc]init];
        [superView addSubview:_titleLabel];
    }
    return _titleLabel;
}
- (UIImageView *)lightView
{
    if(!_lightView)
    {
        UIView *superView = self.contentView;
        _lightView = [[UIImageView alloc]init];
        [superView addSubview:_lightView];
    }
    return _lightView;
}
- (UIImageView *)onlineView
{
    if(!_onlineView)
    {
        UIView *superView = self.contentView;
        _onlineView = [[UIImageView alloc]init];
        [superView addSubview:_onlineView];
    }
    return _onlineView;
}


- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
